package thread;

public class SyncDemo3 {
    public static void main(String[] args) {
        Boo b = new Boo();
        Thread t1 =new Thread(){
            public void run(){
                b.doSome();
            }
        };
        Thread t2 =new Thread(){
            public void run(){
                b.doSome();
            }
        };
        t1.start();
        t2.start();
    }
}

class Boo{
    public static void doSome(){
        synchronized (Boo.class) {
            Thread t = Thread.currentThread();
            System.out.println("doSome的线程是："+t);
            try{
                Thread.sleep(5000);
            }catch(InterruptedException e){
            }
            System.out.println(t+"结束执行");
        }
    }
}